import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '规则名称',
    align:"center",
    dataIndex: 'ruleName'
   },
/*
  {
    title: '周期单位',
    align:"center",
    dataIndex: 'unit_dictText'
  },
*/

   {
    title: '状态',
    align:"center",
    dataIndex: 'status_dictText'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "规则名称",
    field: 'ruleName',
    component: 'Input',
 }
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '规则名称',
    field: 'ruleName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入规则名称!'},
          ];
     },
      colProps: {span: 12},
  },
/*  {
      label: "考勤周期",
      field: 'unit',
      component: 'JDictSelectTag',
      dynamicRules: ({model,schema}) => {
          return [
                { required: true, message: '请选择考勤周期!'},
          ];
      },
      componentProps:{
        dictCode:"attRuleUnit",
      },
      colProps: {span: 12}
      
  },*/
/*  {
    label: '周期单位',
    field: 'unit',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode:"attRuleUnit",
      stringToNumber:true,
    },
    defaultValue:1,
  },*/
  {
    label: '状态',
    field: 'status',
    component: 'JDictSelectTag',
    colProps: {span: 12},
    componentProps:{
        dictCode:"attRuleStatus"
     },
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入状态!'},
          ];
     },
  },

  {
	  label: '',
	  field: 'delFlag',
	  component: 'Input',
	  show: false,
    defaultValue:'0',
	},
 
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];

// 高级查询数据
export const superQuerySchema = {
  ruleName: {title: '规则名称',order: 0,view: 'text', type: 'string',},
  startTime: {title: '上班时间',order: 1,view: 'datetime', type: 'string',},
  endTime: {title: '下班时间',order: 2,view: 'datetime', type: 'string',},
  startUpMins: {title: '上班刷卡提前多少分钟有效',order: 3,view: 'number', type: 'number',},
  startLowerMins: {title: '上班刷卡延迟多少分钟有效',order: 4,view: 'number', type: 'number',},
  endUpMins: {title: '下班刷卡提前多少分钟有效',order: 5,view: 'number', type: 'number',},
  endLowerMins: {title: '下班刷卡延迟多少分钟有效',order: 6,view: 'number', type: 'number',},
  lateMins: {title: '晚到多少分钟不算迟到',order: 7,view: 'number', type: 'number',},
  earlyMins: {title: '早退多少分钟不算早退',order: 8,view: 'number', type: 'number',},
  lateAbsMins: {title: '迟到多少分钟算旷工',order: 9,view: 'number', type: 'number',},
  earlyAbsMins: {title: '早退多少分钟算旷工',order: 10,view: 'number', type: 'number',},
  status: {title: '状态',order: 11,view: 'list', type: 'string',},
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
